package com.cloud.pole.weixin.biz;

import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ace.cache.annotation.Cache;
import com.cloud.pole.common.biz.BaseBiz;
import com.cloud.pole.mapper.WxReplyConfigMapper;
import com.cloud.pole.weixin.model.entity.WxApp;
import com.cloud.pole.weixin.model.entity.WxReplyConfig;

/**
 * ${DESCRIPTION}
 *
 * @author wanghaobin
 * @create 2017-06-08 16:23
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class WxReplyConfigBiz extends BaseBiz<WxReplyConfigMapper, WxReplyConfig> {
	
	@Autowired
	WxReplyConfigMapper mapper;

    public WxReplyConfig selectWxReplyConfig(Integer wxAppId, String eventType, String eventKey) {
		WxReplyConfig record = new WxReplyConfig();
		record.setConfigStatus(WxReplyConfig.CONFIG_STATUS_OK);
		if(!StringUtils.isEmpty(eventKey)) {
			record.setEventKey(eventKey);
		}
		record.setEventType(eventType);
		record.setWxAppId(wxAppId);
		return mapper.selectOne(record);
    }
}
